<template>
    <h3>用户登录</h3>
    <div>
        <table>
            <tr>
                <td>账号：<input type="text" id="UName" v-model="U_Name"></td>
            </tr>
            <tr>
                <td>密码：<input type="password" id="UName" v-model="U_Password"></td>
            </tr>
            <tr>
                <td><input type="button" value="登录" @click="login"></td>
            </tr>
        </table>
    </div>
</template>
<script setup lang="ts">

import { ref } from 'vue'
import axios from 'axios'
const U_Name = ref("")
const U_Password = ref("")
const login = () => {
    axios.get('http://localhost:49165/api/Users/Login', {
        params: {
            name: U_Name.value,
            password: U_Password.value
        }
    })
        .then(res => {
            alert('登陆成功');
            return res;
        })
        .catch(error => {
            alert('登录失败')
            console.log(error)
        })
}
</script>